<template>
    <div class="lobby">
      <div class="swipe">
        <mt-swipe :auto="4000">
          <mt-swipe-item> <img src="@/assets/logo.png" alt=""></mt-swipe-item>
          <mt-swipe-item> <img src="@/assets/logo.png" alt=""></mt-swipe-item>
          <mt-swipe-item> <img src="@/assets/logo.png" alt=""></mt-swipe-item>
        </mt-swipe>
      </div>
      <div class="lobbyMain">
        <div class="select">
          <div @click="showActionsheet"><span>得现金任务</span><img src="@/assets/images/ic_down.png" alt=""></div>
          <div @click="showActionsheet"><span>酬劳高低</span><img src="@/assets/images/ic_down.png" alt=""></div>
        </div>
        <div class="btn">
          <input :class="btnActive == 0? 'active':''" type="button" value="最新" @click="btnChange(0)">
          <input :class="btnActive == 1? 'active':''" type="button" value="热门" @click="btnChange(1)">
          <input :class="btnActive == 2? 'active':''" type="button" value="已作废" @click="btnChange(2)">
        </div>

      </div>
      <div class="content">
        <div class="li" v-for="(item,index) in tabs" :key="index" @click="goDetails">
          <div class="tip">{{item.tip}}</div>
          <div class="details">
            <div class="left">
              <img src="../../../assets/logo.png" alt="">
            </div>
            <div class="right">
              <div class="div">{{item.title}}</div>
              <div class="div">{{item.qqq}}</div>
              <div class="img" >
                <img src="@/assets/images/ic_stars.png" alt="" v-for="i in item.num">
                <img src="@/assets/images/ic_stars2.png" alt="" v-for="i in (5-item.num)">
              </div>
            </div>
          </div>
        </div>
      </div>
      <van-actionsheet v-model="show">
        <van-picker
          show-toolbar
          title="得现金任务"
          :columns="columns"
          @cancel="onCancel"
          @confirm="onConfirm"
        />
      </van-actionsheet>

    </div>
</template>

<script>

  export default {
    mounted() {

    },
    components: {},
    props: {},
    data() {
      return {
        show:false,//上拉菜单
        columns: ['杭州', '宁波', '温州', '嘉兴', '湖州'],
        images: [
          'https://img.yzcdn.cn/public_files/2017/09/05/c0dab461920687911536621b345a0bc9.jpg',
          'https://img.yzcdn.cn/2.jpg'
        ],
        btnActive:0,
        tabs:[{
          title:'网红熊发传单',qqq:'地址在仓山万达金街，穿着网红熊外套发111111111111111...',num:3,tip:'查看奖品'
        },{
          title:'222222222222',qqq:'地址在仓山万达金街，穿着网红熊外套发111111111111111...',num:5,tip:'查看奖品'
        },{
          title:'111111111111111',qqq:'地址在仓山万达金街，穿着网红熊外套发111111111111111...',num:3,tip:'查看奖品'
        },{
          title:'111111111111111',qqq:'地址在仓山万达金街，穿着网红熊外套发111111111111111...',num:3,tip:'查看奖品'
        },{
          title:'111111111111111',qqq:'地址在仓山万达金街，穿着网红熊外套发111111111111111...',num:3,tip:'查看奖品'
        },{
          title:'111111111111111',qqq:'地址在仓山万达金街，穿着网红熊外套发111111111111111...',num:3,tip:'查看奖品'
        },{
          title:'111111111111111',qqq:'地址在仓山万达金街，穿着网红熊外套发111111111111111...',num:3,tip:'查看奖品'
        }],
      }
    },
    computed: {},
    methods: {
      /*
      * btn切换
      * */
      btnChange(e){
        this.btnActive = e
      },
      onConfirm(value, index) {
        console.log(value,index)
        this.show=false
      },
      onCancel() {
        this.show=false
      },
      showActionsheet(){
        this.show=true
      },
      /**
       * 详情
       */
      goDetails(){
        this.$router.push({path:'/lobbyDetails'})
      }
    },
    watch: {},
    filters: {},
    beforeDestroy() {

    }
  }
</script>

<style lang="less">
.lobby{
  height: 100%;
  text-align: center;
  .swipe{
    width: 100%;
    height:2.5rem;
    .van-swipe{
      height:2.5rem;
    }
    img{
      width: 100%;
      height: 100%;
    }
  }
  .lobbyMain{
    padding: 0 0.33rem;
    box-sizing: border-box;
  }
  .select{
    margin-top: 0.6rem;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    color: #333333;
    font-size: 0.28rem;
    div{
      display: flex;
      align-items: center;

    }
    img{
      width: 0.17rem;
      height: 0.1rem;
      margin-left: 0.2rem;
    }
  }
  .btn{
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    margin:  0.26rem 0 0.38rem 0;
    input{
      background:rgba(245,245,246,1);
      border: 0;
      font-size: 0.26rem;
      border-radius: 0.1rem;
      width: 1.42rem;
      color: #CECFD3;
      height: 0.5rem;
    }
    .active{
      background: rgb(255,245,219,1);
      color: #FDCC4A;
    }
  }
  .content{
    padding: 0 0.33rem;
    box-sizing: border-box;
    width: 100%;
    position: absolute;
    top: 4.6rem;
    bottom: 1rem;
    overflow: auto;
    .li{
      position: relative;
      width: 100%;
      height: 2.1rem;
      border-top: 1px solid rgba(239,239,239,0.5);
      .tip{
        font-size: 0.3rem;
        position: absolute;
        top: 0px;
        right: 0px;
        width: 1.42rem;
        height: 0.5rem;
        line-height: 0.5rem;
        background: #FF695A;
        -webkit-border-radius: 0 0 0.1rem 0.1rem;
        -moz-border-radius: 0 0 0.1rem 0.1rem;
        border-radius: 0 0 0.1rem 0.1rem;
        color: #FFFFFF;
      }
      .details{
        width: 100%;
        height: 2.1rem;
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        .left{
          width: 1.56rem;
          height: 1.56rem;
          margin-right: 0.2rem;
          img{
            width: 100%;
            height: 100%;
          }
        }
        .right{
          width: 5rem;
          height: 1.56rem;
          display: flex;
          flex-direction: column;
          justify-content: space-between;
          font-size: 0.36rem;
          .div{
            width: 5rem;
            text-align: left;
            overflow:hidden; //超出的文本隐藏
            text-overflow:ellipsis; //溢出用省略号显示
            white-space:nowrap; //溢出不换行
          }
          div:nth-child(2){
            color: #D2D2D2;
            font-size: 0.26rem;
          }
          .img{
            display: flex;
            flex-direction: row;
            justify-content: left;
            img{
              width: 0.39rem;
              height: 0.38rem;
              margin-right: 0.16rem;
            }
          }
        }
      }

    }
    .li:last-child{
      border-bottom: 1px solid rgba(239,239,239,0.5);
    }
  }
}
</style>
